<?php
class VoteSpaceModel extends Model {	
	public function space($data)
	{
		// 日志列表
		$field = '*';
        $map['uid']= $data['uid'];
		$data = M('vote')->field($field)->where($map)->order('id DESC')->findPage(20) ;//选项
        $optDao = M('vote_opt');
        foreach($data['data'] as $k=>$v) {
            $opts = $optDao->where("vote_id = {$v['id']}")->order("id asc")->field("*")->limit( '0,2' )->findAll();
            $data['data'][$k]['opts'] = $opts;
        }
		return $data;
	}
}